package ${daoImplPackageName};

<#assign keyType="" >
<#assign paramsName="" >
<#if table.ids?size gt 1 >
    <#assign keyType="${table.className!}Key" >
    <#assign paramsName="key" >
import ${modelPackageName}.${keyType};
</#if>
<#if table.ids?size == 1 >
    <#assign keyType="${table.ids[0].fieldType}" >
    <#assign paramsName="${table.ids[0].fieldName}" >
</#if>
import ${daoPackageName}.${(table.className)!}Dao;
import ${mapperPackageName}.${(table.className)!}Mapper;
import ${modelPackageName}.${(table.className)!};
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
* ${(table.className)!}
*
* User: ${userName}
* DateTime: ${dataTime}
*
*/
@Service("${table.className ? uncap_first}Dao")
public class ${(table.className)!}DaoImpl implements ${(table.className)!}Dao {

    @Resource
    private ${(table.className)!}Mapper ${table.className ? uncap_first}Mapper;

    /**
    *
    * 根据主键查询${table.className}对象
    *
    * @param ${paramsName}
    * @return ${table.className}对象
    */
    @Override
    public ${table.className} selectByPrimaryKey(${keyType} ${paramsName}) {
        return ${table.className ? uncap_first}Mapper.selectByPrimaryKey(${paramsName});
    }

    /**
    *
    * 根据查询条件查询符合条件的${table.className}对象
    *
    * @param ${table.className ? uncap_first}
    * @return 符合条件的${table.className}对象List
    */
    @Override
    public List<${table.className}> select(${table.className} ${table.className ? uncap_first}) {
        return ${table.className ? uncap_first}Mapper.select(${table.className ? uncap_first});
    }

    /**
    *
    * 根据主键删除${table.className}对象
    *
    * @param ${paramsName}
    * @return 影响条件数
    */
    @Override
    public int deleteByPrimaryKey(${keyType} ${paramsName}) {
        return ${table.className ? uncap_first}Mapper.deleteByPrimaryKey(${paramsName});
    }

    /**
    *
    * 根据条件删除符合条件的${table.className}对象
    *
    * @param ${table.className ? uncap_first}
    * @return 影响条件数
    */
    @Override
    public int delete(${table.className} ${table.className ? uncap_first}) {
        return ${table.className ? uncap_first}Mapper.delete(${table.className ? uncap_first});
    }

    /**
    *
    * 插入${table.className}对象
    *
    * @param ${table.className ? uncap_first}
    * @return 影响条件数
    */
    @Override
    public int insert(${table.className} ${table.className ? uncap_first}) {
        return ${table.className ? uncap_first}Mapper.insert(${table.className ? uncap_first});
    }

    /**
    *
    * 更新${table.className}对象
    *
    * @param ${table.className ? uncap_first}
    * @return 影响条件数
    */
    @Override
    public int update(${table.className} ${table.className ? uncap_first}) {
        return ${table.className ? uncap_first}Mapper.update(${table.className ? uncap_first});
    }
}
